<template>
    <div class="desc-container">
        <h3>{{ info.title }}</h3>

        <hr>
        <p>{{ info.desc }}</p>
        <img :src="info.img" alt="">
    </div>
</template>

<script>

const API_PROXY = 'https://bird.ioliu.cn/v1/?url=' 
import { Toast } from 'mint-ui'

export default {
    data(){
        return {
            id: this.$route.params.id,
            key: '89c62486-da1e-04d3-d2a2-fef18a9829b6',
            info: {}    //图文数据
        }
    },
    created() {
        this.getGoodsDesc()
    },
    methods: {
        getGoodsDesc(){
            let _this = this
            _this.$axios.get(API_PROXY + 'http://api.web.21ds.cn/pinduoduo/getGoodsDetailInfo?apkey=' + 
            _this.key + '&goods_id_list=["' + _this.id +'"]')
                  .then(function (response) {
                         console.log(response.data.data[0])
                         _this.goodsInfo = response.data.data[0]
                         _this.info = {
                              title: _this.goodsInfo.category_name,
                              desc: _this.goodsInfo.goods_desc,
                              img: _this.goodsInfo.goods_image_url
                         }
                         console.log( _this.info )
                        })
                        .catch(function (err) {
                        Toast(err)
                        })
        }
    }
}
</script>

<style lang="scss" scoped>
.desc-container{
    padding: 4px;
    h3{
        font-size: 30px;
        color: #226aff;
        text-align: center;
        margin: 15px 0;
    }
    p{
        font-size: 14px;
        font-weight: bold;
        color: indigo;
    }
    img{
        width: 100%;
        height: 100%;
    }

}

</style>